<?php

if (!defined("EXPONENT")) exit("");

	$album= null;		
	if (isset($_GET['id'])) {
		$album= $db->selectObject('album', 'id='.$_GET['id']);
		if ($album!= null) {
			$loc = unserialize($album->location_data);
		}
	}
	
	if ($album) {
		$loc = unserialize($album->location_data);
		if (exponent_permissions_check("manage",$loc)) {
			$db->delete('album', 'id='.$_GET['id']);
			$db->decrement('album', 'rank', 1, "location_data='".serialize($loc)."' AND rank > ".$album->rank);
			exponent_flow_redirect();
		} else {
			echo SITE_403_HTML;
		}
	} else {
		echo SITE_404_HTML;
	}

?>